﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using WebSiteAdminTool.UI.Utils.Commands;
using System.Collections.Generic;
using System.Linq;
using WebSiteAdminTool.UI.ViewModels.Base;
using System.Diagnostics;

namespace WebSiteAdminTool.UI.Views.Base
{
    public class BaseUserControl : UserControl
    {
        #region ctors

        public BaseUserControl()
        {
            // design support initialization
        }

        //public BaseUserControl(BaseViewModel viewModel)
        //{
        //    if (viewModel == null)
        //    {
        //        throw new ArgumentNullException("viewModel can't be null, use default constructor instead.");
        //    }

        //    DataContext = viewModel;
        //    if (DataContext is IDisposable)
        //    {
        //        Unloaded += new RoutedEventHandler(DisposeViewModel);
        //    }

        //    //InitializeModel();
        //}

        #endregion

        #region helpers

        //protected virtual void InitializeModel()
        //{
        //    // Note: _viewModel has to be initialized BEFORE this assignment
        //    this.DataContext = _viewModel;
        //}

        //private void DisposeViewModel(object sender, RoutedEventArgs e)
        //{
        //    Debug.Assert(DataContext is IDisposable);
        //    ((IDisposable)DataContext).Dispose();

        //    DataContext = null;
        //}

        #endregion
    }
}
